﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Function.ascx.cs" Inherits="Admin_Components_Member_Function" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True">
</telerik:RadScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <fieldset class="form">
            <div class="form-horizontal wrapper-center clearfix">
                <div class="form-group col-md-6">
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Chức năng cấp trên</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cboFunctionParent" CssClass="col-imp-10" runat="server">
                                <ItemTemplate>
                                    <telerik:RadTreeView runat="server" ID="tvHierarchy" OnClientNodeClicking="rcbHierarchyClientClicking"
                                        OnNodeClick="cboFunctionParentOnNodeClick" />
                                </ItemTemplate>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label star">
                            Loại chức năng</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cboFunctionType" runat="server" CssClass="col-imp-10 comboRequired"
                                OnSelectedIndexChanged="cboFunctionType_SelectedIndexChanged" TabIndex="1" AutoPostBack="true" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label star">
                            Tên chức năng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtFunctionCode" runat="server" Enabled="false" CssClass="col-imp-2" />
                            <telerik:RadTextBox ID="txtFunctionName" runat="server" CssClass="col-imp-8 required"
                                OnTextChanged="txtFunctionName_TextChanged" TabIndex="3" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Cấp chức năng</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cboFunctionLevel" runat="server" CssClass="col-imp-4" OnSelectedIndexChanged="cboFunctionLevel_SelectedIndexChanged"
                                TabIndex="4">
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Text="0" Value="0" />
                                    <telerik:RadComboBoxItem runat="server" Text="1" Value="1" />
                                    <telerik:RadComboBoxItem runat="server" Text="2" Value="2" />
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Nhóm chức năng</label>
                        <div class="col-md-8">
                            <telerik:RadNumericTextBox ID="txtGroupID" runat="server" CssClass="col-imp-4" OnTextChanged="txtGroupID_TextChanged"
                                TabIndex="5">
                                <NumberFormat DecimalDigits="0" />
                            </telerik:RadNumericTextBox>
                        </div>
                    </div>
                </div>
                <div class="form-group col-md-6">
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Số thứ tự</label>
                        <div class="col-md-8">
                            <telerik:RadNumericTextBox ID="txtOderal" runat="server" CssClass="col-imp-4" OnTextChanged="txtOderal_TextChanged"
                                TabIndex="6" MinValue="0">
                                <NumberFormat DecimalDigits="0" />
                            </telerik:RadNumericTextBox>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Đường dẫn chức năng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtWebScreen" runat="server" CssClass="col-imp-10" OnTextChanged="txtWebScreen_TextChanged"
                                TabIndex="7" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            URL Rewrite</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtMethodName" runat="server" CssClass="col-imp-10" TabIndex="8" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Kiểm tra quyền</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cboCheckRole" runat="server" CssClass="col-imp-4" TabIndex="1" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="Có" Value="True" />
                                    <telerik:RadComboBoxItem Text="Không" Value="False" />
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Hiển thị trên menu</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cboMenuDisplay" runat="server" CssClass="col-imp-4" TabIndex="2" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="Có" Value="True" />
                                    <telerik:RadComboBoxItem Text="Không" Value="False" />
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                    <div class="form-group" style="display: none">
                        <label class="col-md-4 control-label">
                            Chức năng</label>
                        <div class="col-md-8">
                            <asp:RadioButton ID="radSysFunction" runat="server" GroupName="ChucNang" TabIndex="8"
                                OnCheckedChanged="radSysFunction_CheckedChanged" />
                            <asp:Label ID="lblSystem" runat="server" Text="Hệ thống" CssClass="lbl1" />
                            <asp:RadioButton ID="radPublicFunction" runat="server" Checked="True" GroupName="ChucNang"
                                TabIndex="9" />
                            <asp:Label ID="lblAll" runat="server" Text="Chung" CssClass="lbl1" />
                        </div>
                    </div>
                    <div class="form-group" style="display: none">
                        <label class="col-md-4 control-label">
                            Chức năng báo cáo</label>
                        <div class="col-md-8">
                            <asp:CheckBox ID="cbType" runat="server" />
                        </div>
                    </div>
                    <div class="form-group" style="display: none">
                        <label class="col-md-4 control-label">
                            Loại hệ thống</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cboSystemFunction" runat="server" TabIndex="1" OnSelectedIndexChanged="cboFunctionParent_SelectedIndexChanged"
                                AutoPostBack="True" />
                        </div>
                    </div>
                </div>

                <div class="form-group text-center">
                    <asp:Label ID="lblQuery" runat="server" ForeColor="Red" />
                </div>
                <div class="set-btns text-center">
                    <asp:Button ID="btnSave" runat="server" Text="Lưu" CssClass="btn btn-sm btn-primary submit"
                        OnClick="btnSave_Click" TabIndex="10" />
                    <asp:Button ID="btnNew" runat="server" Text="Nhập lại" CssClass="btn btn-sm btn-primary"
                        OnClick="btnNew_Click" CausesValidation="false" TabIndex="12" />
                    <asp:Button ID="btnGotoList" runat="server" Text="Danh sách" CssClass="btn btn-sm btn-primary"
                        OnClick="btnGotoList_Click" CausesValidation="false" TabIndex="13" />
                </div>
            </div>
        </fieldset>
       
            <telerik:RadGrid ID="gv" runat="server" CellSpacing="0" CssClass=" table table-bordered" EnableHeaderContextMenu="true"
                Width="100%" GridLines="None" AutoGenerateColumns="False" HeaderStyle-HorizontalAlign="Center"
                AllowMultiRowSelection="True" OnItemCommand="grvData_ItemCommand" OnNeedDataSource="grvData_NeedDataSource"
                HeaderStyle-BorderStyle="None">
                <MasterTableView ShowHeader="true" AllowPaging="True" PageSize="20" NoMasterRecordsText="Không có dữ liệu."
                    ShowGroupFooter="true">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    </ExpandCollapseColumn>
                    <Columns>
                       
                        <telerik:GridTemplateColumn HeaderText="STT" 
                            HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.ItemIndex + 1 %></ItemTemplate>
                            <HeaderStyle Width="50px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn SortExpression="ID" HeaderText="Mã chức năng" ItemStyle-HorizontalAlign="Center"
                            HeaderButtonType="TextButton" DataField="ID" UniqueName="ID" Display="false">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="Type" HeaderText="" ItemStyle-HorizontalAlign="Center"
                            HeaderButtonType="TextButton" DataField="Type" UniqueName="Type" Display="false">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="FunctionName" HeaderText="Tên chức năng"
                            HeaderButtonType="TextButton" DataField="FunctionName" UniqueName="FunctionName">
                            <HeaderStyle HorizontalAlign="Left" />
                            <ItemStyle />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="FunctionLevel" HeaderText="Cấp" HeaderButtonType="TextButton"
                            DataField="FunctionLevel" UniqueName="FunctionLevel" ItemStyle-HorizontalAlign="Center">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="FunctionType" HeaderText="Loại" HeaderButtonType="TextButton"
                            DataField="FunctionType" UniqueName="FunctionType" ItemStyle-HorizontalAlign="Center"
                            Display="false">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="FunctionTypeName" HeaderText="Loại" HeaderButtonType="TextButton"
                            DataField="FunctionTypeName" UniqueName="FunctionTypeName" ItemStyle-HorizontalAlign="Center">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="GroupID" HeaderText="Nhóm" HeaderButtonType="TextButton"
                            DataField="GroupID" UniqueName="GroupID" ItemStyle-HorizontalAlign="Center">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="ParentID" HeaderText="Chức năng cấp trên"
                            HeaderButtonType="TextButton" DataField="ParentID" UniqueName="ParentID" ItemStyle-HorizontalAlign="Center">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn3 column"
                            HeaderText="Chức năng hệ thống" UniqueName="TemplateColumn3">
                            <ItemTemplate>
                                <asp:CheckBox Enabled="false" ID="chkIsSysFunction" runat="server" Checked='<%# Eval("IsSysFunction")%>' />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn SortExpression="WebScreen" HeaderText=" Đường dẫn" HeaderButtonType="TextButton"
                            DataField="WebScreen" UniqueName="WebScreen" ItemStyle-HorizontalAlign="Left">
                            <HeaderStyle HorizontalAlign="Left" />
                            <ItemStyle HorizontalAlign="Left" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="Ordinal" HeaderText="Thứ tự" HeaderButtonType="TextButton"
                            DataField="Ordinal" UniqueName="Ordinal" ItemStyle-HorizontalAlign="Center" FilterControlAltText="Filter Ordinal column">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="Status" HeaderText="Trạng thái" HeaderButtonType="TextButton"
                            DataField="Status" UniqueName="Status" ItemStyle-HorizontalAlign="Center">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Sửa" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="lnkEditItem" CssClass="btnDelete" CommandArgument='<%# Eval("ID") %>'
                                    CommandName="EditItem" runat="server"></asp:Button>
                            </ItemTemplate>
                            <HeaderStyle Width="30px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="Delete" HeaderText="Xóa" HeaderButtonType="TextButton"
                            ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="btnDelete" CssClass="btnX" CommandArgument='<%# Eval("ID") %>' OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa?')"
                                    CommandName="EditDelItem" runat="server"></asp:Button>
                            </ItemTemplate>
                            <HeaderStyle Width="30px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                </MasterTableView>
                <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Selecting AllowRowSelect="true" />
                    <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
                        AllowColumnResize="True"></Resizing>
                </ClientSettings>
                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
            </telerik:RadGrid>
        
    </ContentTemplate>
</asp:UpdatePanel>
<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
<script type="text/javascript">
    function ResetMassage(time, lblResultID) {
        setTimeout(
                function () {
                    document.getElementById(lblResultID).innerHTML = "";
                }, time);
    }
   
    
</script>
